/**
 * 
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 * 
 *   http://www.apache.org/licenses/LICENSE-2.0
 *   
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 * 
 */
package org.jiopi.ibean.example.module.testmodule;

import org.jiopi.framework.ControlPanel;
import org.jiopi.framework.annotation.module.Hotswap;
import org.jiopi.framework.annotation.module.RegisterModule;
import org.jiopi.framework.annotation.module.Instantiation;
import org.jiopi.framework.annotation.module.SocketControlPanel;
import org.jiopi.framework.annotation.module.SocketModule;
import org.jiopi.ibean.example.blueprint.testblueprint.InterfaceControlPanel;
import org.jiopi.ibean.example.blueprint.testblueprint.AbstractClassControlPanel;

/**
 * 
 * 一个类同时实现了 两个 控制面板
 * 
 * 并同时 绑定了 其继承 的 接口和虚类
 * 
 * 该类为原型bean,使用工厂方法
 * 
 * @version 0.1 2010.5.7
 * @since iBean0.2.0.0 2010.5.7
 */
@Hotswap
@Instantiation(factoryMethod="getInstance")
@RegisterModule
public class InterfaceAndAbstractClassControlPanelImpl extends AbstractClassControlPanel implements InterfaceControlPanel {
	
	@SocketControlPanel(id="id",module="module",version="1.1",controlpanel = "controlpanel",configuration="configuration")
	public ControlPanel needControlPanel;
	
	@SocketModule(id="id")
	public AbstractClassControlPanel needAbstractClassControlPanel;
	
	private InterfaceAndAbstractClassControlPanelImpl(){}
	
	private String implName = null;
	
	/**
	 * 工厂方法
	 * @return
	 */
	public static InterfaceAndAbstractClassControlPanelImpl getInstance(){
		return new InterfaceAndAbstractClassControlPanelImpl();
	}
	
	/**
	 * 带参数的工厂方法
	 * @param name
	 * @return
	 */
	public static InterfaceAndAbstractClassControlPanelImpl getInstance(String name){
		InterfaceAndAbstractClassControlPanelImpl impl = new InterfaceAndAbstractClassControlPanelImpl();
		impl.implName = name;
		return impl;
	}
	
	public String interfaceMethod() {
		return "interfaceMethod in InterfaceAndAbstractClassControlPanelImpl"+(implName==null?"":" "+implName);
	}

	@Override
	public String abstractClassMethod() {
		return "abstractClassMethod in InterfaceAndAbstractClassControlPanelImpl"+(implName==null?"":" "+implName);
	}
}
